<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
    <meta name="format-detection" content="telephone=no" />
    <title>测试my.js的util方法</title>
    <script src="../my.js"></script>
    <script src="util.js"></script>
    <style>
    em {
        display: block;
        color: red;
        font-style: normal;
    }
    .clickme {
        background-color: #eee;
        cursor: pointer;
        border: 1px solid red;
    }
    </style>
</head>
<body>
    <script>
    function log() {
        var args = arguments;
        var str = '';

        for (var i = 0; i < args.length; i++) {
            str += args[i].toString();
            if (i < args.length - 1) {
                str += ', ';
            }
        }
        str += '<br>';

        document.write(str);
    }
    </script>
    <h1>测试my.js的util方法</h1>



    <h3>util.countWord(str)</h3>
    <em>半角2个算1个，向上取整</em>
    <script>
    log('my.util.countWord(\'\') return ' + my.util.countWord(''));
    log('my.util.countWord(\'啊\') return ' + my.util.countWord('啊'));
    log('my.util.countWord(\'a\') return ' + my.util.countWord('a'));
    log('my.util.countWord(\'aa\') return ' + my.util.countWord('aa'));
    log('my.util.countWord(\'aaa\') return ' + my.util.countWord('aaa'));
    log('my.util.countWord(\'aaa啊\') return ' + my.util.countWord('aaa啊'));
    </script>
    
    <h3>util.preloadMp3(audios, [debug])</h3>
    <div style="display: none;">
        <audio src="http://www.ayqy.net/music/music/xaaqgs.mp3"></audio>
        <audio src="http://www.ayqy.net/music/music/ydcyxf.mp3"></audio>
    </div>
    <em>audio标签在ipad会占用空间，需要添父元素并设置display: none;</em>
    <em>debug参数可选，为true表示console.log输出已加载完毕的audio标签</em>
    <script>
    my.util.preloadMp3(m$$('audio'), true);
    </script>


</body>
</html>